package top.dingwen.io.treasure.api.event;

import lombok.Getter;
import lombok.Setter;
import org.springframework.context.ApplicationEvent;
import top.dingwen.io.treasure.api.base.constant.ApiConstant;
import top.dingwen.io.treasure.api.base.request.IBaseRequest;

import java.util.Map;

/**
 * 基础事件请求
 *
 * @author dingwen
 * @since 2025/04/24
 */
@SuppressWarnings(ApiConstant.ALL)
@Getter
@Setter
public class BaseEventRequest extends ApplicationEvent implements IBaseRequest {
    /**
     * 参数
     */
    private Map<String, Object> params;

    /**
     * 事件id
     */
    private Long eventId;


    /**
     * 事件名称
     */
    private String eventName;

    /**
     * 事件描述
     */
    private String eventDescription;

    /**
     * 模块
     */
    private String module;


    /**
     * 执行状态: 成功 or 失败
     */
    private Boolean status;

    /**
     * 创建一个事件
     *
     * @param source           事件源,不能为空
     * @param eventName        事件名称
     * @param eventDescription 事件描述
     * @param module           模块
     * @param params           参数
     */
    public BaseEventRequest(Object source, String eventName,
                            String eventDescription, String module,
                            Map<String, Object> params) {
        super(source);
        this.eventName = eventName;
        this.eventDescription = eventDescription;
        this.module = module;
        this.params = params;
    }
}
